Skip to content

Undo externing of floats / variables / strings#559

Merged
JoshSanch merged 1 commit intobfbbdecomp:mainfrom
stravant:undo-extern
May 22, 2025
Merged

Undo externing of floats / variables / strings#559
JoshSanch merged 1 commit intobfbbdecomp:mainfrom
stravant:undo-extern

Conversation

@stravant
Copy link
Collaborator

@stravant stravant commented May 21, 2025

My motivation for doing this is that for my Ghidra import to work I need more files to be temporarily marked as Matching so that additional detailed symbol info is included in the linked executable I dump from. But many of these externed symbols cause linking to fail when it would otherwise succeed. I don't think there's any remaining need to keep these things externed now that we have objdiff to work with so I've done the following:

  • Un-extern various floats, placing them directly inline in the source code and fixing them to be bit-accurate where appropriate (they didn't match the purported value in the comment in the last digit in some cases).

  • Un-extern various local / global variables, placing them in the appropriate part of the data section depending on whether they're zero initialized, uninitialized, or initialized with a value.

  • Make various externed string constants static so that they don't conflict if the files they're in are changed to Matching in configure.py.

@github-actions
Copy link

⚠️ 🔥

+2631 bytes
🆗 Bot Rating: Amazing contribution, you are the decomp GOAT 🐐

Regressions: 11

⚠️ main/SB/Core/x/xBound - .text -35 bytes -> 86.94%
⚠️ main/SB/Core/x/xCamera - .text -4 bytes -> 56.33%
⚠️ main/SB/Core/x/xCamera - .text -16 bytes -> 96.61%
⚠️ main/SB/Core/x/xpkrsvc - .text -4 bytes -> 75.00%
⚠️ main/SB/Game/zMain - .sbss -1 bytes -> 54.55%
⚠️ main/SB/Game/zMain - .text -8 bytes -> 50.93%
⚠️ main/SB/Core/x/xBound - xsqrt(float) -104 bytes -> 27.91%
⚠️ main/SB/Core/x/xCamera - xCameraFOV(xCamera*, float, float, float) -4 bytes -> 97.73%
⚠️ main/SB/Core/x/xCamera - xVec3::operator/=(float) -15 bytes -> 66.67%
⚠️ main/SB/Core/x/xpkrsvc - st_PACKER_ATOC_NODE::Name() const -4 bytes -> 75.00%
⚠️ main/SB/Game/zMain - zLedgeAdjust(zLedgeGrabParams*) -8 bytes -> 55.56%

Progress: 68

📈 main/SB/Game/zScene - .text +11 bytes -> 95.94%
📈 main/SB/Core/x/xEntMotion - .text +16 bytes -> 12.70%
📈 main/SB/Core/x/xCutscene - .text +71 bytes -> 18.15%
📈 main/SB/Core/x/xFFX - .text +12 bytes -> 47.19%
main/SB/Core/x/xCutscene - .bss +864 bytes -> 100.00%
📈 main/SB/Core/x/xBound - .text +28 bytes -> 91.82%
📈 main/SB/Core/x/xEntMotion - .text +224 bytes -> 69.14%
main/SB/Game/zLight - .bss +320 bytes -> 100.00%
📈 main/SB/Game/zGame - .sbss +24 bytes -> 14.29%
main/SB/Core/x/xEntMotion - .text +220 bytes -> 100.00%
📈 main/SB/Game/zLight - .data +88 bytes -> 55.15%
📈 main/SB/Core/x/xCamera - .sdata2 +109 bytes -> 81.82%
📈 main/SB/Game/zCamera - .sbss +6 bytes -> 90.41%
main/SB/Core/x/xEntMotion - .text +116 bytes -> 100.00%
📈 main/SB/Game/zScene - .sdata2 +41 bytes -> 94.12%
main/SB/Core/x/xCamera - .bss +64 bytes -> 100.00%
main/SB/Core/x/xCutscene - .text +64 bytes -> 100.00%
📈 main/SB/Core/x/xCamera - .data +27 bytes -> 69.55%
main/SB/Core/x/xFFX - .sbss +40 bytes -> 100.00%
📈 main/SB/Core/gc/iMath3 - .sdata2 +32 bytes -> 80.56%
📈 main/SB/Core/x/xEntMotion - .text +4 bytes -> 12.50%
📈 main/SB/Core/x/xSnd - .sdata2 +14 bytes -> 66.67%
📈 main/SB/Core/x/xBound - .sdata2 +22 bytes -> 91.67%
📈 main/SB/Core/x/xCamera - .sbss +16 bytes -> 66.67%
main/SB/Core/gc/iMemMgr - .sbss +24 bytes -> 100.00%
main/SB/Core/x/xCamera - .sdata +16 bytes -> 100.00%
main/SB/Core/x/xMath - .sbss +16 bytes -> 100.00%
📈 main/SB/Core/x/xordarray - .sdata2 +5 bytes -> 93.75%
main/SB/Game/zLight - .sbss +16 bytes -> 100.00%
main/SB/Core/x/xCutscene - .sbss +8 bytes -> 100.00%
main/SB/Core/x/xCutscene - .text +8 bytes -> 100.00%
main/SB/Core/x/xEntMotion - .sdata +8 bytes -> 100.00%
main/SB/Core/x/xEntMotion - .text +8 bytes -> 100.00%
main/SB/Core/x/xMemMgr - .sbss +8 bytes -> 100.00%
main/SB/Game/zLight - .sdata2 +8 bytes -> 100.00%
📈 main/SB/Core/x/xGrid - .sbss +5 bytes -> 66.67%
📈 main/SB/Game/zScene - zSceneSetup() +11 bytes -> 88.75%
📈 main/SB/Core/x/xCutscene - xCutscene_Render(xCutscene*, xEnt**, int*, float*) +4 bytes -> 0.16%
📈 main/SB/Core/x/xEntMotion - xEntMotionReset(xEntMotion*, xScene*) +3 bytes -> 0.41%
📈 main/SB/Core/x/xBound - xBoundOBBIsectRay(const xBox*, const xMat4x3*, const xRay3*, xIsect*) +68 bytes -> 80.09%
📈 main/SB/Core/x/xEntMotion - xEntMotionTranslate(xEntMotion*, const xVec3*, xMat4x3*) +4 bytes -> 0.98%
📈 main/SB/Core/x/xFFX - xFFXShakeUpdateEnt(xEnt*, xScene*, float, void*) +4 bytes -> 1.61%
📈 main/SB/Core/x/xEntMotion - xEntMotionMove(xEntMotion*, xScene*, float, xEntFrame*) +4 bytes -> 2.27%
📈 main/SB/Core/x/xFFX - xFFXPoolInit(unsigned int) +4 bytes -> 2.86%
📈 main/SB/Core/x/xFFX - xFFXShakePoolInit(unsigned int) +4 bytes -> 2.86%
main/SB/Core/x/xEntMotion - xVec3Equals(const xVec3*, const xVec3*) +116 bytes -> 100.00%
📈 main/SB/Core/x/xEntMotion - xEntMotionDebugCB() +4 bytes -> 4.17%
main/SB/Core/x/xEntMotion - xQuatEquals(const xQuat*, const xQuat*) +76 bytes -> 100.00%
main/SB/Core/x/xEntMotion - xQuatDot(const xQuat*, const xQuat*) +68 bytes -> 100.00%
main/SB/Core/x/xCutscene - xVec3Lerp(xVec3*, const xVec3*, const xVec3*, float) +64 bytes -> 100.00%
main/SB/Core/x/xEntMotion - xEntERIsRetracting(const xEntMotion*) +48 bytes -> 100.00%
main/SB/Core/x/xEntMotion - xEntERIsExtended(const xEntMotion*) +48 bytes -> 100.00%
main/SB/Core/x/xEntMotion - xQuatFlip(xQuat*, const xQuat*) +44 bytes -> 100.00%
main/SB/Core/x/xCutscene - std::logf(float) +36 bytes -> 100.00%
main/SB/Core/x/xEntMotion - xQuatCopy(xQuat*, const xQuat*) +36 bytes -> 100.00%
main/SB/Core/x/xCutscene - xlog(float) +32 bytes -> 100.00%
📈 main/SB/Core/x/xEntMotion - xSpline3_ArcTotal(xSpline3*) +4 bytes -> 12.50%
main/SB/Core/x/xBound - xVec3::operator=(const xVec3&) +28 bytes -> 100.00%
main/SB/Core/x/xEntMotion - xEntMPSetSpeed(xEntMotion*, float) +28 bytes -> 100.00%
main/SB/Core/x/xEntMotion - xEntERIsRetracted(const xEntMotion*) +28 bytes -> 100.00%
main/SB/Core/x/xEntMotion - xEntERIsExtending(const xEntMotion*) +24 bytes -> 100.00%
main/SB/Core/x/xEntMotion - xEntMotionStop(xEntMotion*) +16 bytes -> 100.00%
main/SB/Core/x/xEntMotion - xEntMotionRun(xEntMotion*) +16 bytes -> 100.00%
main/SB/Core/x/xEntMotion - xEntMotionIsStopped(const xEntMotion*) +12 bytes -> 100.00%
main/SB/Core/x/xCutscene - XCSNNosey::CanRenderNow() +4 bytes -> 100.00%
main/SB/Core/x/xCutscene - XCSNNosey::UpdatedAnimated(RpAtomic*, RwMatrixTag*, unsigned int, unsigned int) +4 bytes -> 100.00%
main/SB/Core/x/xEntMotion - xDrawLine(const xVec3*, const xVec3*) +4 bytes -> 100.00%
main/SB/Core/x/xEntMotion - xDrawSetColor(iColor_tag) +4 bytes -> 100.00%

@JoshSanch JoshSanch merged commit 963cea2 into bfbbdecomp:main May 22, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants